counter=0
def move(n, a, b, c):
    global counter
    if n == 1:
        print(a, '-->', c)
        counter+=1
    else:
        move(n-1, a, c, b)   # 将前n-1个盘子从a移到b
        move(1, a, b, c)     # 将最底下的最后一个盘子从a移到c
        move(n-1, b, a, c)   # 将n-1个盘子从b移到c

n=eval(input())
move(n,'A','B','C')
print(counter)